package cn.jinjimi.domain.data.net;

import cn.jinjimi.domain.data.dto.ArticleAllListDTO;
import cn.jinjimi.domain.data.dto.ArticleListDTO;
import cn.jinjimi.domain.data.dto.ArticleRecommendListDTO;
import cn.jinjimi.app.entity.Article;
import cn.jinjimi.app.entity.ArticleMeta;
import cn.jinjimi.app.entity.SharedCount;

import java.util.HashMap;

import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;

/**
 * Created by zhenhua on 16/7/20.
 */
public interface ReaderService {

    @POST("/reader/shares")
    @FormUrlEncoded
    Call<Article> share(@FieldMap HashMap<String, String> record);

    @GET("/app_shared_record")
    Call<SharedCount> getSharedCount();

    @POST("/reader/collects")
    @FormUrlEncoded
    Call<Article> collect(@Field("article_collect.sso_id") String ssoid, @Field("article_collect.article_id") String articleId);

    @GET("/reader/collects")
    Call<ArticleListDTO> getCollects(@Query("sso_id") String ssoid, @Query("page") int page, @Query("limit") int limit);

    @DELETE("/reader/collects/{articleId}")
    Call<ResponseBody> unCollect(@Path("articleId") String articleId);

    @GET("/reader/articles/{articleId}/meta")
    Call<ArticleMeta> getArticleMetaData(@Path("articleId") String articleId, @Query("sso_id") String ssoid);

    @GET("/reader/{ssoid}/stats/week")
    Call<ArticleListDTO> getArticlesOfWeek(@Path("ssoid") String ssoid);

    @GET("/reader/articles/search")
    Call<ArticleListDTO> searchArticles(@Query("title") String title, @Query("page") int page, @Query("limit") int limit);

    @GET("/reader/articles/list")
    Call<ArticleAllListDTO> getArticleAllList(@Query("page") int page, @Query("limit") int limit);

    @GET("/bxr/reader/recommend")
    Call<ArticleRecommendListDTO> getArticleRecommend(@Query("offset") int page, @Query("limit") int limit);

}